package com.wzcl.app.model.vo;

import com.wzcl.app.dao.model.Feedback;
import com.wzcl.app.model.common.WZCL;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.util.Map;

@Data
public class FeedbackVo extends BaseVo{

    @ApiModelProperty(value = "类型")
    private Integer type;
    private String typeStr;

    @ApiModelProperty(value = "反馈类容")
    private String content;

    @ApiModelProperty(value = "提供人电话")
    private String provider;

    @ApiModelProperty(value = "处理人电话")
    private String processor;

    @ApiModelProperty(value = "处理人方案")
    private String program;

    @ApiModelProperty(value = "满意度")
    private String Satisfaction;

    @ApiModelProperty(value = "评价")
    private String comment;

    @ApiModelProperty(value = "进度")
    private Integer schedule;
    private String scheduleStr;

    private FeedbackVo() {
    }

    public static FeedbackVo create(Feedback feedback) {
        FeedbackVo feedbackVo = new FeedbackVo();
        BeanUtils.copyProperties(feedback,feedbackVo);
        feedbackVo.translationValueStr();
        return feedbackVo;
    }

    @Override
    public void translationValueStr(){
        Map<String, Map<Integer, String>> map = getTranslationMap();
        this.typeStr = map.get(WZCL.GROUP_NAME.FEEDBACK_TYPE).get(this.type);
        this.scheduleStr = map.get(WZCL.GROUP_NAME.SCHEDULE).get(this.schedule);
    }

    @Override
    public void processResources() {

    }

    @Override
    public String toString() {
        return "FeedbackVo{" +
                "type=" + type +
                ", typeStr='" + typeStr + '\'' +
                ", content='" + content + '\'' +
                ", provider='" + provider + '\'' +
                ", processor='" + processor + '\'' +
                ", program='" + program + '\'' +
                ", Satisfaction='" + Satisfaction + '\'' +
                ", comment='" + comment + '\'' +
                ", schedule=" + schedule +
                ", scheduleStr='" + scheduleStr + '\'' +
                '}';
    }
}
